package com.itheima.controller;

import com.itheima.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserService userService;

    @DeleteMapping("/delete")
    public ResponseEntity<Void> deleteUser(@RequestParam("userId")Long userId){

        userService.deleteUser(userId);
        //返回状态码:204
        return ResponseEntity.status(HttpStatus.NO_CONTENT).build();
    }
}
